const packager = require('electron-packager')
const buildConfig = require('./build.config')
const packageJSON = require("../package.json")
const path = require("path")

if (process.platform === 'win32') {
  throw new Error("暂不支持在该平台打包")
}

const installer = require('electron-installer-debian')

const archAlias = {
  linuxx64: "amd64"
}

const options = {
  src: path.resolve(buildConfig.out, `${packageJSON.name}-${process.platform}-${process.arch}/`),
  dest: path.resolve(buildConfig.out, 'installers/'),
  arch: archAlias[process.platform + process.arch] || process.arch,
  name: "pack-test",
  description: "linux打包deb测试description",
  productDescription: "linux打包deb测试productDescription",
  productName: "打包测试",
  categories: ["Utility", "Application"],
  lintianOverrides: [
    "changelog-file-missing-in-native-package"
  ],
  authors: ["tfswx"],
  tags: ["Utility"]
}


packager(buildConfig).then(() => {
  console.log("打包完成")
  installer(options).then(() => {
    console.log("打成安装包成功")
  })
})
